import './99project.scss';
import CONSTANT from '@/common/constants.js';
import http from '@/common/http.js';
import Search from 'vux/src/components/search/index.vue'
import XProgress from 'vux/src/components/x-progress/index.vue'
import Tab from 'vux/src/components/tab/tab.vue'
import TabItem from 'vux/src/components/tab/tab-item.vue'
import Sticky from 'vux/src/components/sticky/index.vue'
import Flexbox from 'vux/src/components/flexbox/flexbox.vue'
import FlexboxItem from 'vux/src/components/flexbox/flexbox-item.vue'
import Scroller from 'vux/src/components/scroller/index.vue'
import Loading from 'vux/src/components/loading/index.vue'
export default {
  name: '99project',
  components: {
    Search,
    XProgress,
    Tab,
    TabItem,
    Sticky,
    Flexbox,
    FlexboxItem,
    Scroller,
    Loading
  },
  data () {
    return {
      loadingShow:false,
      inText: '',
      value: '',
      hotList: '',
      typeList: '',

      medicineNum: '',
      otherNum: '',
      poolNum: '',
      studyNum: '',
      oneToOneNum: '',
      allNum: '',

      allnumber: '',
      index: 0,
      isA: true,
      isB: false,
      eventListQB: '',
      eventListQB1: '',
      eventListjinqi: '',
      eventListwangqi: '',
      eventListsearch: '',
      pageNosearch: 1,
      pageNoJinqi: 1,
      pageNoWangqi: 0,
      pageSize: 20,
      demo: '近期项目',
      noMoreEvent: '点击加载更多',
      use_pullup: true,
      areaShow: true,
      pullup_con: {
        content: ' ',
        pullUpHeight: 60,
        height: 40,
        autoRefresh: false,
        downContent: ' ',
        upContent: ' ',
        loadingContent: ' ',
        clsPrefix: 'xs-plugin-pullup-'
      }
    }
  },
  watch: {
    value: function (val) {
      //console.log('watchValue')
      this.pageNosearch = 1
      this.pageNoJinqi = 1
      this.pageNoWangqi = 0
      if (val != '') {
        http.post(CONSTANT.EVENT_SEARCH, {keyWords: val, pageNo: this.pageNosearch, pageSize: this.pageSize}, (res) => {
          console.log(res)
          if (this.value != '') {
            if (res.errmsg == '没有更多的项目') {
              return
            }
            this.allnumber = res.list[0].number
            this.eventListsearch = res.list
            this.eventListQB = this.eventListsearch
            this.eventListjinqi = ''
            this.eventListwangqi = ''
          }
        })
      } else {
        this.eventListQB = ''
        this.eventListjinqi = ''
        this.eventListwangqi = ''
        this.eventListsearch = ''
        this.pageNosearch = 1
        this.allnumber = ''
        this.$nextTick(() => {
          this.$refs.scroller.donePullup()
          this.$refs.scroller.reset()
        })
      }
    }
  },
  created() {


  },
  mounted () {
    this.$emit('ShareAppMessage','99公益｜我们一起来为公益代言', '浙江青基会99公益日众筹项目发布', 'http://www.qqchou.org/wx/?#/99project', this.imageUrl.imageUrl + '/userfiles/2018/9/1536132333.jpg')
    var obj1={
      name:"“情暖童心”资助计划",
      id:0,
      dw:"浙江省青少年发展基金会",
      url:'http://tsw-qqc.oss-cn-hangzhou.aliyuncs.com/99/1.jpg',
      link:'https://ssl.gongyi.qq.com/m/weixin/detail.htm?showwxpaytitle=1&pid=205051&et=tx_gzh&gt=m_99&ADTAG=idx.m.m_99&bid=&pt=',
      num:500000
    };
    var obj2={
      name:"向阳花儿童助医",
      id:1,
      dw:"浙江省青少年发展基金会",
      url:'http://tsw-qqc.oss-cn-hangzhou.aliyuncs.com/99/2.jpg',
      link:'https://ssl.gongyi.qq.com/m/weixin/detail.htm?showwxpaytitle=1&pid=1950&et=&gt=m_99&ADTAG=idx.m.m_99&bid=&pt=',
      num:2380444
    };
    var obj3={
      name:"留守儿童心理帮扶",
      id:1,
      dw:"杭州滴水公益服务中心",
      url:'http://tsw-qqc.oss-cn-hangzhou.aliyuncs.com/99/3.jpg',
      link:'https://ssl.gongyi.qq.com/m/weixin/detail.htm?showwxpaytitle=1&pid=205080&et=tx_gzh&gt=m_99&ADTAG=idx.m.m_99&bid=&pt=',
      num:350080
    };
    var obj4={
      name:"梦想足球场",
      id:1,
      dw:"浙江省青少年发展基金会",
      url:'http://tsw-qqc.oss-cn-hangzhou.aliyuncs.com/99/4.jpg',
      link:'https://ssl.gongyi.qq.com/m/weixin/detail.htm?showwxpaytitle=1&pid=19845&et=&gt=m_99&ADTAG=idx.m.m_99',
      num:5000000
    };
    var obj5={
      name:" 天恒公益计划",
      id:2,
      dw:"浙江省青少年发展基金会",
      url:'http://tsw-qqc.oss-cn-hangzhou.aliyuncs.com/99/5.jpg',
      link:'https://ssl.gongyi.qq.com/m/weixin/detail.htm?showwxpaytitle=1&pid=201042&et=&gt=m_99&ADTAG=idx.m.m_99',
      num:250000
    };
    var obj6={
      name:"安利快乐音乐教室",
      id:1,
      dw:"浙江省青少年发展基金会",
      url:'http://tsw-qqc.oss-cn-hangzhou.aliyuncs.com/99/6.jpg',
      link:'https://ssl.gongyi.qq.com/m/weixin/detail.htm?showwxpaytitle=1&pid=205052&et=&gt=m_99&ADTAG=idx.m.m_99',
      num:120000
    };
    var obj7={
      name:"爱回西藏4",
      id:3,
      dw:"浙江省青少年发展基金会",
      url:'http://tsw-qqc.oss-cn-hangzhou.aliyuncs.com/99/7.jpg',
      link:'https://ssl.gongyi.qq.com/m/weixin/detail.htm?showwxpaytitle=1&pid=204452&et=&gt=m_99&ADTAG=idx.m.m_99',
      num:126000
    };
    var obj8={
      name:"小鸭子宝宝的梦想",
      id:1,
      dw:"杭州逐梦天使助医公益服务中心",
      url:'http://tsw-qqc.oss-cn-hangzhou.aliyuncs.com/99/8.jpg',
      link:'https://ssl.gongyi.qq.com/m/weixin/detail.htm?showwxpaytitle=1&pid=204451&et=&gt=m_99&ADTAG=idx.m.m_99',
      num:150000
    };
    var obj9={
      name:"爱情充电 婚姻加油",
      id:4,
      dw:"杭州益嘉仁社会工作服务中心",
      url:'http://tsw-qqc.oss-cn-hangzhou.aliyuncs.com/99/9.jpg',
      link:'https://ssl.gongyi.qq.com/m/weixin/detail.htm?showwxpaytitle=1&pid=206031&et=&gt=m_99&ADTAG=idx.m.m_99',
      num:300000
    };
    var obj10={
      name:"“三点半”课堂",
      id:1,
      dw:"东阳市爱盟社会工作服务中心",
      url:'http://tsw-qqc.oss-cn-hangzhou.aliyuncs.com/99/10.jpg',
      link:'https://ssl.gongyi.qq.com/m/weixin/detail.htm?showwxpaytitle=1&pid=205440&et=&gt=m_99&ADTAG=idx.m.m_99',
      num:117600
    };
    var obj11={
      name:"大手拉小手",
      id:5,
      dw:"东阳矫正协会",
      url:'http://tsw-qqc.oss-cn-hangzhou.aliyuncs.com/99/11.jpg',
      link:'https://ssl.gongyi.qq.com/m/weixin/detail.htm?showwxpaytitle=1&pid=205441&et=&gt=m_99&ADTAG=idx.m.m_99',
      num:44580
    };
    var obj12={
      name:"生日“益”起暖",
      id:1,
      dw:"德清县清禾公益事业发展中心",
      url:'http://tsw-qqc.oss-cn-hangzhou.aliyuncs.com/99/12.png',
      link:'https://ssl.gongyi.qq.com/m/weixin/detail.htm?showwxpaytitle=1&pid=204612&et=&gt=m_99&ADTAG=idx.m.m_99',
      num:66110
    };
    var obj13={
      name:"常山县关爱留守儿童公益计划",
      id:6,
      dw:"常山县阳光志愿者协会",
      url:'http://tsw-qqc.oss-cn-hangzhou.aliyuncs.com/99/13.jpg',
      link:'https://ssl.gongyi.qq.com/m/weixin/detail.htm?showwxpaytitle=1&pid=204618&et=&gt=m_99&ADTAG=idx.m.m_99',
      num:111000
    };
    var obj14={
      name:"希望生计划",
      id:6,
      dw:"开化县商企义工服务中心",
      url:'http://tsw-qqc.oss-cn-hangzhou.aliyuncs.com/99/14.jpg',
      link:'https://ssl.gongyi.qq.com/m/weixin/detail.htm?showwxpaytitle=1&pid=204617&et=&gt=m_99&ADTAG=idx.m.m_99',
      num:300000
    };
    var obj15={
      name:"城市遗忘者餐厅",
      id:7,
      dw:"金华市幸扶家人公益服务中心",
      url:'http://tsw-qqc.oss-cn-hangzhou.aliyuncs.com/99/15.jpg',
      link:'https://ssl.gongyi.qq.com/m/weixin/detail.htm?showwxpaytitle=1&pid=31220&et=&gt=m_99&ADTAG=idx.m.m_99',
      num:300000
    };
    var obj16={
      name:"希望工程一对一助学",
      id:0,
      dw:"浙江省青少年发展基金会",
      url:'http://tsw-qqc.oss-cn-hangzhou.aliyuncs.com/99/16.png',
      link:'https://ssl.gongyi.qq.com/m/weixin/detail_yqj.htm?id=4388&did=1200038101201809052500005714&ADTAG=&et=fx&code=071voByj0RRlPm124yyj0Eriyj0voBy2&state=',
      num:300000
    };
    this.eventListQB=[obj1,obj3,obj5,obj7,obj9,obj11,obj13,obj15];
    this.eventListQB1=[obj2,obj4,obj16,obj6,obj8,obj10,obj12,obj14];
  },
  methods: {
    goProject (url) {
      window.location.href=url;
    },
    goHello () {
      this.$router.push({path: '/Hello'})
    },
    onScrollBottom() {

    }
  }
}
function getResult (val) {
  let rs = []
  for (let i = 0; i < 20; i++) {
    rs.push({
      title: `${val} result: ${i + 1} `,
      other: i
    })
  }
  return rs
}
